/*
 * @# ActionUtils.java 2011-11-19 下午04:35:50
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.sen.pro.switches.core.util;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.sen.pro.switches.core.cfg.ENV;

/**
 * action工具类，初始化一些公共数据
 * 
 * @author tian qingsen
 */
public class ActionUtils {
	public static void initSiteImg(HttpServletRequest request) {
		initSiteLogoImg(request);
		initSiteAdvsImg(request);
	}

	public static void initSiteLogoImg(HttpServletRequest request) {
		request.setAttribute("logoUrl", SiteFileUtil.getSiteLogoImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR));
	}
	
	public static void initSiteAdvsImg(HttpServletRequest request) {
		request.setAttribute("advImg1", SiteFileUtil.getSiteAdvsImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR, "1"));
		request.setAttribute("advImg2", SiteFileUtil.getSiteAdvsImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR, "2"));
		request.setAttribute("advImg3", SiteFileUtil.getSiteAdvsImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR, "3"));
		request.setAttribute("advImg4", SiteFileUtil.getSiteAdvsImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR, "4"));
		request.setAttribute("advImg5", SiteFileUtil.getSiteAdvsImgName(ServletActionContext.getServletContext()
				.getRealPath("/") + ENV.IMG_DIR, "5"));
	}
}
